#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
//int main()
//
//{
//	char arr[5];
//
//
//	
//		scanf("%s", arr);
//	
//	if (arr[0] == arr[1] && arr[0] != arr[2] && arr[2] != arr[3] && arr[1] != arr[3])
//		printf("yes");
//	else
//		printf("no");
//}
int main()
{
	int arr[1001];
	
	int n;
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	int count[1001] = { 0};
	for (int i= 0; i < 1001; i++)
    {
		count[arr[i]]++;
	}
	int max_count = 0;
	for (int i = 0; i < 1001; i++)
	{
		if (max_count < count[i])
		{
			max_count = count[i];
		}
	}
	int printed[1001] = { 0 };
	for (int i = 0; i < n; i++)
	{
		int num = arr[i];
		if (count[num]==max_count && printed[num] ==0)
		{
			printf("%d", num);
			printed[num] = 1;
		}
	}
	return 0;
}